package com.snjx.micro.oauth.gateway.config.netty;

import lombok.AccessLevel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.FieldDefaults;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

/**
 * @author by suonanjiexi
 * @version 1.0
 * @apiNote TODO
 * @date 2020/8/5 2:35 下午
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Component
@ConfigurationProperties(prefix="netty")
@FieldDefaults(level = AccessLevel.PRIVATE)
@Validated
public class HttpServerConfig {
    boolean  soKeepalive;
    boolean  tcpNodelay;
    Group group=new Group();
    IdleTime idleTime=new IdleTime();
    Channel channel=new Channel();
    @Data
    @FieldDefaults(level = AccessLevel.PRIVATE)
    public static class Group {
         Integer bossGroupThreads;
         Integer workGroupThreads;
    }
    @Data
    @FieldDefaults(level = AccessLevel.PRIVATE)
    public static class IdleTime {
        Integer readerIdleTimeSeconds;
        Integer writerIdleTimeSeconds;
        Integer allIdleTimeSeconds;
    }@Data
    @FieldDefaults(level = AccessLevel.PRIVATE)
    public static class Channel {
        Integer soRcvbuf;
        Integer soSndbuf;
        Integer soBacklog;
        Integer connectTimeOutMillis;
    }
}
